package com.dragon.concurrent.demo.future;

import java.util.concurrent.TimeUnit;

public class SyncInvoker {

    public static void main(String[] args) throws InterruptedException {
        FutureService futureService = new FutureService();
        Future<String> future = futureService.submit(() -> {
            TimeUnit.SECONDS.sleep(10L);

            return "finish";
        }, System.out::println);
        System.out.println(Thread.currentThread().getName() + " ========== do other thing ===========");
        TimeUnit.SECONDS.sleep(6L);
        System.out.println(Thread.currentThread().getName() + " =========== finish other thing ===========");
//        System.out.println("result:" + future.get());
    }

    public static String get() throws InterruptedException {
        TimeUnit.SECONDS.sleep(10L);

        return "finish";
    }
}
